//
//  NewsInfoViewController.m
//  MemberProject
//
//  Created by vincent luo on 15/5/14.
//  Copyright (c) 2015年 MAC OS X. All rights reserved.
//

#import "NewsInfoViewController.h"
#import "NewsInfoTableViewCell.h"
@interface NewsInfoViewController ()
@property (nonatomic,strong)NSMutableArray *dataArr;
@end

@implementation NewsInfoViewController

- (void)viewDidLoad {
    [super viewDidLoad];
    // Do any additional setup after loading the view from its nib.
        [self.mainTableView registerNib:[UINib nibWithNibName:@"NewsInfoTableViewCell" bundle:nil] forCellReuseIdentifier:@"CellIdentifier"];
    self.dataArr = [NSMutableArray arrayWithArray:@[@"ff",@"访问发大量会计法畸洽客无假放",@"放弃我就立刻放假了完全可减肥了口气问积分理科前金额为离开房间了我去看"]];
    self.mainTableView.separatorStyle = UITableViewCellSeparatorStyleNone;
}

- (void)didReceiveMemoryWarning {
    [super didReceiveMemoryWarning];
    // Dispose of any resources that can be recreated.
}
-(NSInteger)numberOfSectionsInTableView:(UITableView *)tableView
{
    return 1;
}
-(NSInteger)tableView:(UITableView *)tableView numberOfRowsInSection:(NSInteger)section
{
    return self.dataArr.count;
}
-(CGFloat)tableView:(UITableView *)tableView heightForRowAtIndexPath:(NSIndexPath *)indexPath
{
    CGFloat height =[Utils heightForTextView:self.dataArr[indexPath.row] andFont:15 andWidth:SCREEN_WIDTH-133];
    if (height>30) {
        return height-30+80;
    }
    else
        return 80;
    
}
-(UITableViewCell *)tableView:(UITableView *)tableView cellForRowAtIndexPath:(NSIndexPath *)indexPath
{
    NewsInfoTableViewCell *cell = [tableView dequeueReusableCellWithIdentifier:@"CellIdentifier" forIndexPath:indexPath];
    if (indexPath.row==0) {
        cell.upLine.hidden = YES;
    }else
        cell.upLine.hidden = NO;
    
    
    
    cell.contentHeight.constant =[Utils heightForTextView:self.dataArr[indexPath.row] andFont:15 andWidth:SCREEN_WIDTH-133]+1;
    cell.titleLabel.text = self.dataArr[indexPath.row];
    
    return cell;
}
/*
#pragma mark - Navigation

// In a storyboard-based application, you will often want to do a little preparation before navigation
- (void)prepareForSegue:(UIStoryboardSegue *)segue sender:(id)sender {
    // Get the new view controller using [segue destinationViewController].
    // Pass the selected object to the new view controller.
}
*/

@end
